package cn.smartorigin.soas.frame;

import java.awt.Dimension;

import javax.swing.ImageIcon;
import javax.swing.JButton;

public class ImageButton extends JButton{
	private static final long serialVersionUID = 1L;
	int width;
	int height;
	
	/**
	 * 
	 * @param img			正常显示的图片
	 * @param imgRollover	鼠标划过的图片	
	 * @param imgPressed	鼠标按下后的图片
	 */
	public ImageButton(ImageIcon img, ImageIcon imgRollover, ImageIcon imgPressed){
		
		width =img.getIconWidth();
		height = img.getIconHeight();
		
		this.setBorder(null);
		this.setMargin(null);
		this.setContentAreaFilled(false);
		this.setOpaque(false);
		this.setRolloverEnabled(true);	
		//this.setSize(width, height);
		this.setSize(new Dimension(width, height));
		
		this.setIcon(img);
		this.setPressedIcon(imgPressed);
		this.setRolloverIcon(imgRollover);
	}
}
